﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.ComponentModel.Composition;

namespace Dynamic_UI_Framework
{
    [Export(typeof(GridPanelAdapter))]
    [PartCreationPolicy(CreationPolicy.Shared)]
    public class GridPanelAdapter : AdapterBase<IPanel, Grid>
    {
        protected override void Adapt(IPanel codon, Grid target)
        {
            Panel p = codon as Panel;
            p.Target = target;

            target.ContextMenu = new ContextMenu();
            foreach (var item in p.GetMenuItem())
            {
                target.ContextMenu.Items.Add(item);
            }
        }

        protected override IPanel Create()
        {
            return new Panel();
        }
    }
}
